package com.atguigu.jxc.controller;

import com.alibaba.fastjson.JSON;
import com.atguigu.jxc.service.impl.UnitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Description:
 * @Author: Gavin
 * @Date: 9/11/2023 7:00 PM
 */
@RequestMapping("/unit")
@Api(tags = "商品单位查询")
@RestController
public class UnitController {
    @Autowired
    UnitService unitService;
    @ApiOperation("查询所有商品的单位")
    @PostMapping("list")
    public String queryUnits(){
        Map<String,Object> map = unitService.queryAllunits();
        return JSON.toJSONString(map);
    }
}
